home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 April / macformat-049.iso / mac / Shareware Plus / Developers / dropg++ / usr / include / sys / signal.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  6.7 KB  |  195 lines  |  [TEXT/R*ch]

  1. /*
  2.  * Copyright (c) 1982, 1986, 1989, 1991, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  * (c) UNIX System Laboratories, Inc.
  5.  * All or some portions of this file are derived from material licensed
  6.  * to the University of California by American Telephone and Telegraph
  7.  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  8.  * the permission of UNIX System Laboratories, Inc.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  *    @(#)signal.h    8.2 (Berkeley) 1/21/94
  39.  */
  40.  
  41. #ifndef    _SYS_SIGNAL_H_
  42. #define    _SYS_SIGNAL_H_
  43.  
  44. #define NSIG    32        /* counting 0; could be 33 (mask is 1-32) */
  45.  
  46. #ifndef _ANSI_SOURCE
  47. #include <machine/signal.h>    /* sigcontext; codes for SIGILL, SIGFPE */
  48. #endif
  49.  
  50. #define    SIGHUP    1    /* hangup */
  51. #define    SIGINT    2    /* interrupt */
  52. #define    SIGQUIT    3    /* quit */
  53. #define    SIGILL    4    /* illegal instruction (not reset when caught) */
  54. #ifndef _POSIX_SOURCE
  55. #define    SIGTRAP    5    /* trace trap (not reset when caught) */
  56. #endif
  57. #define    SIGABRT    6    /* abort() */
  58. #ifndef _POSIX_SOURCE
  59. #define    SIGIOT    SIGABRT    /* compatibility */
  60. #define    SIGEMT    7    /* EMT instruction */
  61. #endif
  62. #define    SIGFPE    8    /* floating point exception */
  63. #define    SIGKILL    9    /* kill (cannot be caught or ignored) */
  64. #ifndef _POSIX_SOURCE
  65. #define    SIGBUS    10    /* bus error */
  66. #endif
  67. #define    SIGSEGV    11    /* segmentation violation */
  68. #ifndef _POSIX_SOURCE
  69. #define    SIGSYS    12    /* bad argument to system call */
  70. #endif
  71. #define    SIGPIPE    13    /* write on a pipe with no one to read it */
  72. #define    SIGALRM    14    /* alarm clock */
  73. #define    SIGTERM    15    /* software termination signal from kill */
  74. #ifndef _POSIX_SOURCE
  75. #define    SIGURG    16    /* urgent condition on IO channel */
  76. #endif
  77. #define    SIGSTOP    17    /* sendable stop signal not from tty */
  78. #define    SIGTSTP    18    /* stop signal from tty */
  79. #define    SIGCONT    19    /* continue a stopped process */
  80. #define    SIGCHLD    20    /* to parent on child stop or exit */
  81. #define    SIGTTIN    21    /* to readers pgrp upon background tty read */
  82. #define    SIGTTOU    22    /* like TTIN for output if (tp->t_local<OSTOP) */
  83. #ifndef _POSIX_SOURCE
  84. #define    SIGIO    23    /* input/output possible signal */
  85. #define    SIGXCPU    24    /* exceeded CPU time limit */
  86. #define    SIGXFSZ    25    /* exceeded file size limit */
  87. #define    SIGVTALRM 26    /* virtual time alarm */
  88. #define    SIGPROF    27    /* profiling time alarm */
  89. #define SIGWINCH 28    /* window size changes */
  90. #define SIGINFO    29    /* information request */
  91. #endif
  92. #define SIGUSR1 30    /* user defined signal 1 */
  93. #define SIGUSR2 31    /* user defined signal 2 */
  94.  
  95. #if defined(_ANSI_SOURCE) || defined(__cplusplus)
  96. /*
  97.  * Language spec sez we must list exactly one parameter, even though we
  98.  * actually supply three.  Ugh!
  99.  */
  100. #define    SIG_DFL        (void (*)(int))0
  101. #define    SIG_IGN        (void (*)(int))1
  102. #define    SIG_ERR        (void (*)(int))-1
  103. #else
  104. #define    SIG_DFL        (void (*)())0
  105. #define    SIG_IGN        (void (*)())1
  106. #define    SIG_ERR        (void (*)())-1
  107. #endif
  108.  
  109. #ifndef _ANSI_SOURCE
  110. typedef unsigned int sigset_t;
  111.  
  112. /*
  113.  * Signal vector "template" used in sigaction call.
  114.  */
  115. struct    sigaction {
  116.     void    (*sa_handler)();    /* signal handler */
  117.     sigset_t sa_mask;        /* signal mask to apply */
  118.     int    sa_flags;        /* see signal options below */
  119. };
  120. #ifndef _POSIX_SOURCE
  121. #define SA_ONSTACK    0x0001    /* take signal on signal stack */
  122. #define SA_RESTART    0x0002    /* restart system on signal return */
  123. #define    SA_DISABLE    0x0004    /* disable taking signals on alternate stack */
  124. #ifdef COMPAT_SUNOS
  125. #define    SA_USERTRAMP    0x0100    /* do not bounce off kernel's sigtramp */
  126. #endif
  127. #endif
  128. #define SA_NOCLDSTOP    0x0008    /* do not generate SIGCHLD on child stop */
  129.  
  130. /*
  131.  * Flags for sigprocmask:
  132.  */
  133. #define    SIG_BLOCK    1    /* block specified signal set */
  134. #define    SIG_UNBLOCK    2    /* unblock specified signal set */
  135. #define    SIG_SETMASK    3    /* set specified signal set */
  136.  
  137. #ifndef _POSIX_SOURCE
  138. #ifndef KERNEL
  139. #include <sys/cdefs.h>
  140. #endif
  141. typedef    void (*sig_t) __P((int));    /* type of signal function */
  142.  
  143. /*
  144.  * Structure used in sigaltstack call.
  145.  */
  146. struct    sigaltstack {
  147.     char    *ss_base;        /* signal stack base */
  148.     int    ss_size;        /* signal stack length */
  149.     int    ss_flags;        /* SA_DISABLE and/or SA_ONSTACK */
  150. };
  151. #define    MINSIGSTKSZ    8192            /* minimum allowable stack */
  152. #define    SIGSTKSZ    (MINSIGSTKSZ + 32768)    /* recommended stack size */
  153.  
  154. /*
  155.  * 4.3 compatibility:
  156.  * Signal vector "template" used in sigvec call.
  157.  */
  158. struct    sigvec {
  159.     void    (*sv_handler)();    /* signal handler */
  160.     int    sv_mask;        /* signal mask to apply */
  161.     int    sv_flags;        /* see signal options below */
  162. };
  163.  
  164. #define SV_ONSTACK    SA_ONSTACK
  165. #define SV_INTERRUPT    SA_RESTART    /* same bit, opposite sense */
  166. #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
  167.  
  168. /*
  169.  * Structure used in sigstack call.
  170.  */
  171. struct    sigstack {
  172.     char    *ss_sp;            /* signal stack pointer */
  173.     int    ss_onstack;        /* current status */
  174. };
  175.  
  176. /*
  177.  * Macro for converting signal number to a mask suitable for
  178.  * sigblock().
  179.  */
  180. #define sigmask(m)    (1 << ((m)-1))
  181.  
  182. #define    BADSIG        SIG_ERR
  183.  
  184. #endif    /* !_POSIX_SOURCE */
  185. #endif    /* !_ANSI_SOURCE */
  186.  
  187. /*
  188.  * For historical reasons; programs expect signal's return value to be
  189.  * defined by <sys/signal.h>.
  190.  */
  191. __BEGIN_DECLS
  192. void    (*signal __P((int, void (*) __P((int))))) __P((int));
  193. __END_DECLS
  194. #endif    /* !_SYS_SIGNAL_H_ */
  195.